package com.sian.security.web.model;

import java.io.Serializable;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name="role")
public class Role implements Serializable
{
	private static final long serialVersionUID = 1532016765322253106L;
	
	public static final String ROLE_USER = "USER";
	public static final String ROLE_MANAGER = "MANAGER";
	public static final String ROLE_ROOT = "ROOT";
	
	private long id;
	private String roleName;
	
	@XmlAttribute
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}

	@XmlElement(nillable=true)
	public String getRoleName() {
		return roleName;
	}
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	
	@Override
	public boolean equals(Object obj)
	{
		Role r = (Role)obj;
		if(r.id == id
				&&r.roleName == roleName)
		{
			return true;
		}
		
		return false;
	}
	
	@Override
	public String toString()
	{
		return "ID: " + id + "; ROLE_NAME: " + roleName; 
	}
}
